package cn.fudong.bos.action.base;

import java.util.List;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Controller;

import cn.fudong.bos.action.commom.BaseAction;
import cn.fudong.bos.domain.base.TakeTime;
import cn.fudong.bos.service.base.TakeTimeService;

/**
 * 
 * @description:快递员取派时间管理
 * @author ：d_fu
 * @date 创建时间：2018年3月12日 下午3:48:56
 *
 */
@ParentPackage("json-default")
@Namespace("/")
@Controller
@Scope("prototype")
public class TakeTimeAction extends BaseAction<TakeTime> {
	// taketime_findAll

	@Autowired
	private TakeTimeService takeTimeService;

	// takeTime_pageQuery

	// 加载页面:分页查询操作
	@Action(value = "takeTime_pageQuery", results = { @Result(name = "success", type = "json") })
	public String pageQuery() {
		Pageable pageable = new PageRequest(page - 1, rows);
		Page<TakeTime> pageData = takeTimeService.findPageData(pageable);
		
		pushPageDataToValueStack(pageData);

		return SUCCESS;
	}

	@Action(value = "taketime_findAll", results = { @Result(name = "success", type = "json") })
	public String findAll() {

		List<TakeTime> takeTimes = takeTimeService.findAll();

		// 压入值栈
		pushDataToValueStack(takeTimes);
		return SUCCESS;

	}
}
